<template>
  <base-layout :visibleContent="false">
    <template #searchPanel>
      <DialogDataForm :value="filters" type="edit" :ownedCustomer="true" @operate="saveFrom"/>
    </template>
  </base-layout>
</template>

<script>
import { getClientCarById,editClient } from '@/api/after-sale/client/car'
import baseMixin from '@/mixins/base'
import { parseTimeToYMDHMS } from '@/utils'
import ElRow from 'element-ui/packages/row/src/row'
import ElCol from 'element-ui/packages/col/src/col'
import DialogDataForm from '@/views/after-sale/client-manage/edit/components/DialogDataForm.vue'
export default {
  components: { ElCol, ElRow, DialogDataForm },
  mixins: [
    baseMixin({
      format(res) {
        return res.map((data) => {
          return data
        })
      },
    }),
  ],
  data() {
    return {
      filters:{},
      disabledType: false, //静用状态
    }
  },
  async created() {
    let { id } = this.$route.query
    getClientCarById(id).then((res) => {
      let { success, data } = res
      if (success) {
        this.filters = data;
        this.filters.carModels=[data.carBrandId,data.carSeriesId,data.timeType,data.carModelId]
      }
    })
  },
  methods: {
    //表单保存
    saveFrom(formValue){
      editClient(formValue).then(res=>{
        let {success}=res;
        if(success){
          this.$message.success('修改成功');
          this.closeRouter();
        }else{
          this.$message.error('修改失败');
        }
      })
    }
  },
  mounted() {},
}
</script>

<style lang="scss" scoped>
.el-table .delete-row {
  background: #f5f7fa;
  color: #ccc !important;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 80px;
  height: 80px;
  display: block;
}
</style>
